/* 618电商网站样式 */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 导航栏 */
.nav {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.nav-logo {
    font-size: 24px;
    font-weight: bold;
    color: #ff4d4f;
    text-decoration: none;
}

.nav-cart {
    position: relative;
    padding: 8px 15px;
    background-color: #ff4d4f;
    color: white;
    border-radius: 20px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.nav-cart:hover {
    background-color: #ff7875;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ffd666;
    color: #000;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
}

/* 商品列表 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.current-price {
    font-size: 24px;
    color: #ff4d4f;
    font-weight: bold;
}

.original-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.discount {
    font-size: 14px;
    color: #ff4d4f;
    background-color: #fff1f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.product-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: #ffd666;
    color: #ad6800;
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background-color: #ff4d4f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.add-to-cart:hover {
    background-color: #ff7875;
}

/* 商品详情页 */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px 0;
}

.product-detail-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-detail-info {
    padding: 20px;
}

.product-description {
    margin: 20px 0;
    color: #666;
    line-height: 1.6;
}

/* 购物车页面 */
.cart-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 2fr 1fr 1fr auto;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-name {
    padding: 0 20px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    padding: 5px 10px;
    border: 1px solid #d9d9d9;
    background: white;
    cursor: pointer;
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: 1px solid #d9d9d9;
    padding: 5px;
}

.cart-item-price {
    color: #ff4d4f;
    font-weight: bold;
}

.remove-item {
    color: #ff4d4f;
    background: none;
    border: none;
    cursor: pointer;
}

.cart-summary {
    display: flex;
    justify-content: flex-end;
    padding: 20px;
    font-size: 18px;
}

.cart-total {
    color: #ff4d4f;
    font-weight: bold;
    margin-left: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .product-detail {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 80px 1fr;
        gap: 20px;
    }

    .cart-item > * {
        grid-column: 2;
    }

    .cart-item-image {
        grid-column: 1;
        grid-row: 1 / span 4;
    }
}